<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <style>
      * {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
        list-style: none;
      }
      a {
        color: black;
        text-decoration: none;
      }
      li {
        width: 50px;
        height: 30px;
        line-height: 30px;
        text-align: center;
      }
      .son {
        visibility: hidden;
      }
      .son li {
        /*display: none;*/
        border: 1px solid orange;
        border-top: 1px solid transparent;
      }
      .son li:hover {
        background-color: darkorange;
      }
      .father {
        float: left;
      }
      .father:hover {
        background-color: #f1f1f1;
      }
    </style>
  </head>
  <body>
    <ul>
      <li class="father">
        <a href="#">微博</a>
        <ul class="son">
          <li><a href="#">私信</a></li>
          <li><a href="#">评论</a></li>
          <li><a href="#">@我</a></li>
        </ul>
      </li>
      <li class="father">
        <a href="#">微博</a>
        <ul class="son">
          <li><a href="#">私信</a></li>
          <li><a href="#">评论</a></li>
          <li><a href="#">@我</a></li>
        </ul>
      </li>
      <li class="father">
        <a href="#">微博</a>
        <ul class="son">
          <li><a href="#">私信</a></li>
          <li><a href="#">评论</a></li>
          <li><a href="#">@我</a></li>
        </ul>
      </li>
    </ul>
    <script>
      var li = document.querySelectorAll(".father");
      for (let i = 0; i < li.length; i++) {
        li[i].onmouseover = function () {
          var son = this.children[1];
          son.style.visibility = "visible";
        };
        li[i].onmouseout = function () {
          var son = this.children[1];
          son.style.visibility = "hidden";
        };
      }
    </script>
  </body>
</html>
